import Taro from "@tarojs/taro-h5";
import Nerv from "nervjs";

var _this = this;

import { View } from '@tarojs/components';
import './HeroIndex.scss';
import { heroTypes } from '../../../Config';

class HeroIndex extends Taro.Component {
  render() {
    const props = this.props;

    const { indexes, current, onChange, mode, onModeChange } = props;
    return <View className="HeroIndex">
      <View className="HeroIndex-Mode" onClick={onModeChange}>
        {mode}
      </View>
      {indexes.map(index => <View className={`HeroIndex-Index ${current === index ? 'selected' : ''}`} key={index} onClick={onChange.bind(this, index)}>
          {mode === '职业' ? heroTypes[Number(index) - 1] : index}
        </View>)}
    </View>;
  }

}

export default HeroIndex;